package play

import "fmt"

type SalaryCalculator interface {
	CalculateSalary() int
}
type Permanent struct {
	empId    int
	basicpay int
	pf       int
}
type Contract struct {
	empId    int
	basicpay int
}

func (p Permanent) CalculateSalary() int {
	return p.basicpay + p.pf
}
func (c Contract) CalculateSalary() int {
	return c.basicpay
}
func totalExpense(s []SalaryCalculator) {
	expense := 0
	for _, v := range s {
		expense = expense + v.CalculateSalary()
	}
	fmt.Printf("total expense is %d", expense)
}
func RunInterface() {
	p1 := Permanent{1, 5000, 20}
	p2 := Permanent{2, 6000, 30}
	c1 := Contract{3, 3000}
	employees := []SalaryCalculator{p1, p2, c1}
	totalExpense(employees)
}
